# -*- coding: utf-8 -*-
"""
Spyder Editor
余数，一圈
This is a temporary script file.
"""

n = 8
step = 4
cnt = 0
s = []
for i in range(n): s.append(1)
print(s)
i = 0
Runing = True
while Runing:
    if s[i] == 0:
        i = (i+1)%n
        continue
    if cnt==step-1:
        if s[i]==1:
            s[i] = 0
            cnt = -1
        else:
            cnt = (cnt-1)%step
    if s.count(1)==1:
        Runing=False
    i = (i+1) % n
    cnt = (cnt+1)%step
print(s)
    